package com.qudian.java.core.common.utils;

import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * Created by wangyi on 16/6/12.
 */
public class ParmUtils {

    private static Logger logger = LoggerFactory.getLogger(ParmUtils.class);

    public static Integer checkStringAndGetInteger(String parm){
        Integer parmInt = null;
        if(StringUtils.isBlank(parm))return parmInt;
        try {
            parmInt = Integer.parseInt(parm);
        }catch (Exception e){
            logger.error("String转换Integer异常",e.getMessage());
        }
        return parmInt;
    }

    public static Float checkStringAndGetFloat(String parm){
        Float parmFloat = null;
        if(StringUtils.isBlank(parm))return parmFloat;
        try {
            parmFloat = Float.parseFloat(parm);
        }catch (Exception e){
            logger.error("String转换Integer异常",e.getMessage());
        }
        return parmFloat;
    }
}
